package com.ultrapower.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ultrapower.commons.result.PageInfo;
import com.ultrapower.mapper.SmsLogMapper;
import com.ultrapower.model.SmsLog;
import com.ultrapower.service.ISmsLogService;

/**
 *
 * SysLog 表数据服务层接口实现类
 *
 */
@Service
public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> implements ISmsLogService {
    
	@Autowired
    private SmsLogMapper smsLogMapper;
	
    @Override
    public void selectDataGrid(PageInfo pageInfo) {
        Page<SmsLog> page = new Page<SmsLog>(pageInfo.getNowpage(), pageInfo.getSize());
        EntityWrapper<SmsLog> wrapper = new EntityWrapper<SmsLog>();
        wrapper.orderBy(pageInfo.getSort(), pageInfo.getOrder().equalsIgnoreCase("ASC"));
        selectPage(page, wrapper);
        pageInfo.setData(page.getRecords());
        pageInfo.setCount(page.getTotal());
    }

	@Override
	public List<SmsLog> selectStopData() {
		EntityWrapper<SmsLog> wrapper = new EntityWrapper<SmsLog>();
		wrapper.eq("issendmsg", 1);
        wrapper.eq("isreplymsg", 1);
        wrapper.eq("isdowntime", 0);
        List<SmsLog> list = smsLogMapper.selectList(wrapper);
		return list;
	}

	@Override
	public List<SmsLog> selectIsSendData() {
		EntityWrapper<SmsLog> wrapper = new EntityWrapper<SmsLog>();
		wrapper.eq("issendmsg", 1);
        wrapper.eq("isreplymsg", 0);
        wrapper.eq("isdowntime", 0);
        List<SmsLog> list = smsLogMapper.selectList(wrapper);
		return list;
	}

	@Override
	public List<String> selectIsSendList() {
		List<String> list = smsLogMapper.selectIsSendList();
		return list;
	}
    
}